/*
*  路由守卫
*/
import { AxiosError } from 'axios'
import router from '~/router'

const allowList = ['/login', '/error', '/401', '/404', '/403']
const loginPath = '/login'

router.beforeEach(async (to, from, next) => {
    console.log('router.beforeEach', to, from)
    const token = null;
    if(token == null){
        if (!allowList.includes(to.path) && !to.path.startsWith('/redirect')) {
            next({
                path: loginPath,
                query: {
                    redirect: encodeURIComponent(to.fullPath),
                },
            })
            return;
        }
    } else {

    }
    next()
})


router.afterEach((to) => {

})
